const User = require('../models/User')
module.exports = async (req, res, next) => {
  if (!req._id) {
    next()
    return
  }
  let user = await User.findById(req._id)
  if (user.roles.includes('blacklist')) {
    res.error(401, '你已被拉黑，请联系管理员')
  } else {
    next()
  }
}
